#include<iostream>
using namespace std;
const int maxn=1010;
int N;
int n1=0,n2=0;
int lowerstlayer=0,abovelayer=-1;
struct node{
    int data;
    int layer;
    node* lchild=NULL;
    node* rchild=NULL;
};
node* newNode(int x,int layer){
    node* Node=new node;
    Node->data=x;
    Node->layer=layer;
    return Node;
}
void insert(node* &root, int x,int layer){
    if(root==NULL){
        root=newNode(x,layer);
    }
    else if(root->data>=x){
        insert(root->lchild,x,layer+1);
    }
    else{
        insert(root->rchild,x,layer+1);
    }
}

void adjustlayer(int layer){
    if(layer>lowerstlayer){
        abovelayer=lowerstlayer;
        lowerstlayer=layer;
        n2=n1;
        n1=1;
    }
    else if(lowerstlayer==layer){
        n1++;
    }
    else if(abovelayer==layer){
        n2++;
    }
}

void DFS(node* root){
    adjustlayer(root->layer);
    if(root->lchild==NULL && root->rchild==NULL) return;
    if(root->lchild!=NULL) DFS(root->lchild);
    if(root->rchild!=NULL) DFS(root->rchild);
}
int main(){
    //freopen("in.txt","r",stdin);
    scanf("%d",&N);
    node *root=NULL;
    int Bstdata;
    for(int i=0;i<N;i++){
        scanf("%d",&Bstdata);
        insert(root,Bstdata,1);
    }
    DFS(root);
    printf("%d + %d = %d",n1,n2,n1+n2);
}
